#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, m;
int head[N], deg[N];
int ver[N], Next[N], tot;
void init() {
  rep(i, 1, n) head[i] = deg[i] = 0;
  tot = 0;
}
void add(int u, int v) {
  ++tot;
  ver[tot] = v;
  Next[tot] = head[u];
  head[u] = tot;
}
void solve() {
  cin >> n >> m;
  init();
  rep(i, 1, m) {
    int u, v;
    cin >> u >> v;
    add(v, u);  // reverse
    deg[u]++;
  }
  priority_queue<int> pq;
  rep(i, 1, n) if (!deg[i]) pq.push(i);
  vector<int> ans;
  while (pq.size()) {
    int u = pq.top();
    ans.push_back(u);
    pq.pop();
    for (int i = head[u]; i; i = Next[i]) {
      int v = ver[i];
      if (--deg[v] == 0) pq.push(v);
    }
  }
  if (ans.size() != n) {
    cout << "Impossible!\n";
  } else {
    reverse(ans.begin(), ans.end());
    for (int x : ans) cout << x << ' ';
    cout << endl;
  }
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}